<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // ES6类的写法
        class IPhone {
            constructor(id) {
                this.id = id;
            }
            static myName = 'cc';
            name = 'aa';
            brand = 'apple';
            static heySiri() {
                console.log(this);
            }
        }
        IPhone.heySiri();
        const ldh = new IPhone(1);
        console.log(ldh.id);

        // 构造函数的写法
        function Star(uname, age, sex) {
            this.uname = uname;
            this.age = age;
            this.sex = sex;
        }

        const zxy = new Star('张学友');
        Star.uname = '刘德华';
        console.log(zxy.uname);
        console.log(Star.uname);
    </script>
</body>
</html>